import Vue from 'vue'
import Vuex from 'vuex'
import loginModule from './modules/loginModule'
Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    get getToken(){
     return JSON.parse(localStorage.getItem('token'))
    },
    set setToken(val){
      localStorage.setItem('token',JSON.stringify(val))
    }
  },
  mutations: {
      LOGIN_IN(state,payload){
        state.setToken = payload;
      },
      LONGIN_OUT(state){
        state.setToken = ''
      }
  },
  actions: {
  },
  modules: {
    loginModule
  }
})
